package com.cavy.platform.server.domain.job;

import lombok.Data;

import java.util.Objects;

/**
 * @author 唐旭
 * @Date 2018/7/27
 */
@Data
public class JobId {
    protected String number;
    protected String pipelineName;
    protected String projectName;
    protected String workspaceName;

    public JobId() {
    }

    public JobId(Job job) {
        this.number = job.getNumber();
        this.pipelineName = job.getPipelineName();
        this.projectName = job.getProjectName();
        this.workspaceName = job.getWorkspaceName();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        JobId jobId = (JobId) o;
        return Objects.equals(number, jobId.number) &&
                Objects.equals(pipelineName, jobId.pipelineName) &&
                Objects.equals(projectName, jobId.projectName) &&
                Objects.equals(workspaceName, jobId.workspaceName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(number, pipelineName, projectName, workspaceName);
    }
}
